package com.jiyang.rpidisplay;

import android.content.Context;
import android.content.SharedPreferences;
import android.content.pm.PackageManager;

/**
 * -------------------------------
 * Created by JiYang on 3/6/18.
 * -------------------------------
 */

public class SPUtil {
    private static SharedPreferences getSp(Context context) {
        String SP_NAME = "RPI_DISPLAY";
        return context.getSharedPreferences(SP_NAME, Context.MODE_PRIVATE);
    }

    public static String getString(Context context, String key) {
        SharedPreferences sp = getSp(context);
        return sp.getString(key, "");
    }

    public static void saveString(Context context, String key, String value) {
        SharedPreferences sp = getSp(context);
        sp.edit().putString(key, value).apply();
    }
}
